package com.ycc.springcloud.service.impl;


import com.ycc.springcloud.mapper.OrderListMapper;
import com.ycc.springcloud.pojo.OrderList;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @Author: ycc
 * @Date: 2021/6/27 10:36
 */
@Service
public class OrderService {
    @Autowired
    OrderListMapper mapper;

    /**
     * username添加订单
     * @param order
     * @return
     */
    public int addOrder(OrderList order){
        return mapper.insert(order);
    }




    /**
     * 查看username的所有订单
     * @param username
     * @return
     */
    public List<OrderList> selectAllByUsername(String username){
        return mapper.selectAllByUsername(username);
    }

    /**
     * 删除某个订单
     * @param id
     * @return
     */
    public int deleteByOrderId(String id){
        return mapper.deleteById(id);
    }
}
